var Global = {
	WssService: "wss://api.itool.store/v1/.ws",
	ItoolStoreApi: "https://api.itool.store/",
	FileService: "https://file.help-itool.com/"
};

var UserInfo = function(info) {
	if (info) {
		uni.setStorageSync('userInfo', JSON.stringify(info));
	} else {
		var userinfostr = uni.getStorageSync('userInfo');
		if (userinfostr) {
			var userInfo = JSON.parse(userinfostr);
			if (!userInfo.paras || !userInfo.paras.replace(/\s*/g, "")) {
				userInfo.paras = {
					userName: '未定义',
					headImg: '/static/img/face.jpg'
				};
			} else {
				userInfo.paras = JSON.parse(userInfo.paras);
			}
			return userInfo;
		}else{
			return {};
		}
		
	}
}

export default {
	Global: {
		WssService: "wss://api.itool.store/v1/.ws",
		ItoolStoreApi: "https://api.itool.store/",
		FileService: "https://file.help-itool.com/",
		Uploader: Global.FileService + "/upload/file"
	},
	GlobalQueue: {
		QueuePlus: Global.ItoolStoreApi + ".v1/queue/.push"
	},
	GlobalSocketUser: {

		WsByClient: Global.ItoolStoreApi + ".v1/socket/user/.wsbyclient",
		OutLoginWs: Global.ItoolStoreApi + ".v1/socket/user/.wsbyservice",

		AddMember: Global.ItoolStoreApi + ".v1/socket/Relationship/.member",
		GetMembers: Global.ItoolStoreApi + ".v1/socket/Relationship/" + UserInfo().id + "/" + UserInfo().projectToken,

		OutLoginWs: Global.ItoolStoreApi + ".v1/socket/user/.wsbyservice"
	},
	UserInfo: UserInfo,
	AppOnStatus:function(){
		
		var AppOnStatus = uni.getStorageSync('AppOnStatus');
		if (AppOnStatus == 'show') {
			return true;
		} else if (AppOnStatus == 'hide'){
			return false;
		}

	}
};
